#include "chatmessagehandle.h"
#include <iostream>

namespace QinChat{
    namespace Chat{
        CChatMessageHandle::CChatMessageHandle(){

        }

        CChatMessageHandle::~CChatMessageHandle(){

        }

        bool CChatMessageHandle::HandelMessage(std::shared_ptr<Net::CSession> pSession, rapidjson::Document& doc){
            return false;
        }



        /////////////////////////////////////////////////
        CChatMessageHandleRegist::CChatMessageHandleRegist(){

        }

        CChatMessageHandleRegist::~CChatMessageHandleRegist(){
        }

        void CChatMessageHandleRegist::Regist(const std::string& type, CChatMessageHandle* pMessageHandel){
            if (m_msgHanelTypes.IsContains(type)){
                std::cout<<"regist messhage handel failed \n";
                return;
            }
            std::cout<<"regist messhage handel success\n";
            m_msgHanelTypes.Insert(type, pMessageHandel);
        }

        CChatMessageHandle* CChatMessageHandleRegist::GetMessageHandel(const std::string& type){
            CChatMessageHandle* pNode = nullptr;
            if (!m_msgHanelTypes.Find(type, pNode)){
                return nullptr;
            }
            else{
                return pNode->Clone();
            }
        }

        
    }
}